package com.pinghua.mocha.basics.enumerate.fwct;


import com.coffee.core.CoffeeEnum;

/**
 * @author songkui
 * @since 2024/5/8 18:08
 */
public enum DateTypeEnum implements CoffeeEnum<String> {
    Day("D", "天"),
    Moth("M", "月"),
    Year("Y", "年");

    private final String code;
    private final String label;

    DateTypeEnum(String code, String label) {
        this.code = code;
        this.label = label;
    }

    @Override
    public String code() {
        return this.code;
    }

    @Override
    public String label() {
        return this.label;
    }


    public static DateTypeEnum ofCode(String code) {
        for (DateTypeEnum type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
       return null;
    }

}
